﻿using System;
using System.Collections.Generic;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;

namespace YArchitech.HVAC.AuxiliaryCurve
{
	public class AuxiliaryDrawFactory
	{
		public Plane CurPlane { get; set; }

		public AuxiliaryDrawFactory(ExternalCommandData amdArgu, Dictionary<XYZ, XYZ> dicXArgu, Dictionary<XYZ, XYZ> dicYArgu, ref ICollection<ElementId> idsArgu, AuxiliaryCurveType typeArgu, Plane planeArgu = null)
		{
			this.m_cmdData = amdArgu;
			this.dicX = dicXArgu;
			this.dicY = dicYArgu;
			this.ids = idsArgu;
			this.type = typeArgu;
			this.CurPlane = planeArgu;
		}

		public AuxiliaryDraw CreateAuxiliaryDraw()
		{
			AuxiliaryDraw result = null;
			switch (Convert.ToInt16(this.type))
			{
			case 0:
			case 1:
			case 2:
			case 3:
				result = new DetailLineDraw(this.m_cmdData, this.dicX, this.dicY, ref this.ids);
				break;
			case 4:
			case 5:
			case 6:
			case 7:
				result = new DetailArcDraw(this.m_cmdData, this.dicX, this.dicY, ref this.ids);
				break;
			case 8:
			case 9:
			case 10:
			case 11:
				result = new RefPlaneDraw(this.m_cmdData, this.dicX, this.dicY, ref this.ids);
				break;
			case 12:
			case 13:
				result = new ModelLineDraw(this.m_cmdData, this.dicX, this.dicY, ref this.ids, this.CurPlane);
				break;
			}
			return result;
		}

		private ExternalCommandData m_cmdData;

		private Dictionary<XYZ, XYZ> dicX;

		private Dictionary<XYZ, XYZ> dicY;

		private ICollection<ElementId> ids;

		private AuxiliaryCurveType type;
	}
}
